function [TotalData YFIT]=prepareReturn(datavec,quarterinfo)
% quarter info include 2 column, the last price of previous quarter and the
% whole daily prices.
pos1=1;
TotalData=[];YFIT = [];
for i=1:size(quarterinfo,1)
    pos2=sum(quarterinfo(1:i,2));
    tem=(datavec(pos1+1:pos2,end)-datavec(pos1:pos2-1,end))...
        ./datavec(pos1:pos2-1,end)*100;
    if ~isnan(quarterinfo(i,1))
        fstdayreturn=(datavec(pos1,end)-quarterinfo(i,1))...
            /quarterinfo(i,1)*100;
        TotalData = [TotalData;[[fstdayreturn;tem] datavec(pos1:pos2,:)]];
         YFIT=[YFIT;mean([tem' fstdayreturn])];
    else
        TotalData = [TotalData;[[NaN;tem] datavec(pos1:pos2,:)]];
        YFIT=[YFIT;mean(tem)];
        
    end
    pos1=pos2+1;
end